// @ts-ignore
/* eslint-disable */
import { OpenApi as request } from "@/utils/request";

/** 收获地址列表 GET /mall/user/address */
export async function listUserAddress(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.listUserAddressParams,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponsePageRespMallUserAddressVo>(
    `/barter-user/mall/user/address`,
    {
      method: "GET",
      params: {
        ...params,
      },
      ...(options || {}),
    }
  );
}

/** 新增收获地址 POST /mall/user/address */
export async function addUserAddress(
  body: API.MallUserAddressDto,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean>(`/barter-user/mall/user/address`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 获取收获地址详情 GET /mall/user/address/${param0} */
export async function getUserAddress(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getUserAddressParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<API.BaseResponseMallUserAddressVo>(
    `/barter-user/mall/user/address/${param0}`,
    {
      method: "GET",
      params: { ...queryParams },
      ...(options || {}),
    }
  );
}

/** 更新收获地址 PUT /mall/user/address/${param0} */
export async function editUserAddress(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.editUserAddressParams,
  body: API.MallUserAddressDto,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<API.BaseResponseBoolean>(
    `/barter-user/mall/user/address/${param0}`,
    {
      method: "PUT",
      headers: {
        "Content-Type": "application/json",
      },
      params: { ...queryParams },
      data: body,
      ...(options || {}),
    }
  );
}

/** 删除收获地址 DELETE /mall/user/address/${param0} */
export async function delUserAddress(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.delUserAddressParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<API.BaseResponseBoolean>(
    `/barter-user/mall/user/address/${param0}`,
    {
      method: "DELETE",
      params: { ...queryParams },
      ...(options || {}),
    }
  );
}

/** 设置为默认 PUT /mall/user/address/default/${param0} */
export async function defaultUserAddress(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.defaultUserAddressParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<API.BaseResponseBoolean>(
    `/barter-user/mall/user/address/default/${param0}`,
    {
      method: "PUT",
      params: { ...queryParams },
      ...(options || {}),
    }
  );
}
